<?php
session_start();
include 'connect.php';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<link rel="stylesheet" type="text/css" href="styles.css"/>
<link rel="stylesheet" type="text/css" href="forms.css"/>

	<title>Sign Up</title>
	<meta name="generator" content="BBEdit 9.5" />
<!-- jquery validation -->	
	
</head>
<body>
<div class="logo"></div> 
<div id="container">
<div id="MainContent">
<div id="user">
<?php
				if (isset($_SESSION['MemberID'])){
					echo "Hi, ".$_SESSION['Username'].".<br />";
				}
				?>

<?php if (isset($_SESSION['MemberID'])){ echo "<a href='logout.php'>Logout</a>";}?>

</div>
<div class="clear"></div>

<div class="linksContainer">
<?php 

//print_r($_SESSION['MemberID']);
if(isset($_SESSION['MemberID'])){
	
	echo "<a href='welcome.php' class='links'>Home Page</a>";
	echo "<a href='memberProfile.php' class='links'>My Profile</a>";
	echo "<a href='memberProjects.php' class='links'>My Projects</a>";
	echo "<a href='projMan.php' class='links'>View Current Projects</a>";
	echo "<a href='createProject.php' class='links'>Create a Project</a>";

			}
			else echo "Please <a href='index.php'>login</a> to access this page.";
			

?>
</div><!--linksContainer-->	
<?php

	if (isset($_SESSION['MemberID'])){
					//$ProjectID = mysql_real_escape_string($_GET["ProjectID"]);
					$sql = "SELECT * FROM project WHERE CreatorID=".$_SESSION['MemberID'];
					$result = mysql_query($sql);
					if (!$result) {
					    $message  = 'Invalid query: ' . mysql_error() . "\n" . 'Whole query: ' . $sql;
					    die($message);
					}
					$row = mysql_fetch_assoc($result);
					?>
					
					 <form method="post" action="insertProject.php">
					 <fieldset>
					   <legend>Create a project</legend>
						<input id="ProjectID" name="ProjectID" type="hidden" />
					   <p>
					     <label for="Project_Name">Project Name</label><em>*</em><br />
					     <input type="text" id="Project_Name" class="text" name="Project_Name" size="25" class="required" minlength="2" />
					   </p>
					   <p>
					     <label for="Status">Status</label><em>*</em><br />
					     <input text="type" id="Status" class="text" name="Status" size="25" size="<?php echo strlen($row["Status"]); ?>" class="required" />
					   </p>
					   <p>
					     <label for="Description">Description</label><em>*</em><br />
					     <textarea id="Description" class="text" name="Description" rows="3" cols="40" class="required">
					     </textarea>
					   </p>
					   <p>
					<input type="submit" value="Submit" name="Submit"/>
					   </p>
					 </fieldset>
					 </form>
					 <?php 
				}
				else echo "Please <a href='index.php'>login</a> to access this page.";
				?>
			


		
</div><!-- MainContent -->
</div><!-- container -->
</body>
</html>